package com.wicket.okrfinance.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrfinance.biz.service.dto.req.*;
import com.wicket.okrfinance.biz.service.dto.res.*;
import com.wicket.okrfinance.common.exception.BizException;
import com.wicket.okrfinance.common.util.CommonFunctionHelper;
import com.wicket.okrfinance.common.util.RedisUtil;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wicket.okrfinance.base.service.MOmsAccountService;
import com.wicket.okrcalc.integration.dto.ApproveSucceedStandardDataComRespDto;
import com.wicket.okrcalc.integration.dto.ApproveSucceedStandardDataComReqDto;
import com.wicket.okrfinance.common.exception.Assert;
import com.wicket.okrfinance.biz.service.nb.NbStandardData;
import com.wicket.okrcalc.integration.FwCalcStandardDataClient;
import com.wicket.okrfinance.biz.service.FinanceService;
import com.wicket.okrcalc.integration.dto.ImplementApprovecurrentContentStandardDataComRespDto;
import com.wicket.okrcalc.integration.dto.ImplementApprovecurrentContentStandardDataComReqDto;
import com.wicket.okrcalc.integration.dto.RefreshReportAndRelateStandardDataComRespDto;
import com.wicket.okrcalc.integration.dto.RefreshReportAndRelateStandardDataComReqDto;
import com.wicket.okrcalc.integration.FwCalcTargetCalcClient;

/**
 * @author ：
 * @date ：
 * 
 *
 * @version 1.0
 */
@Service
public class StandardDataServiceImpl
  implements com.wicket.okrfinance.biz.service.StandardDataService {

  @Resource
  private RedisUtil redisUtil;
@Resource
  private MOmsAccountService mOmsAccountService;
@Resource
  private NbStandardData nbStandardData;
@Resource
  private FwCalcStandardDataClient fwCalcStandardDataClient;
@Resource
  private FinanceService financeService;
@Resource
  private FwCalcTargetCalcClient fwCalcTargetCalcClient;
/**
   * D7执行当前内容财务及标准数据(公共)[8561]
   * gen by moon at 7/4/2024, 1:50:20 AM
   */
  @Trace(operationName = "D7执行当前内容财务及标准数据(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public ImplementCurrentContentFinancialAndStandardDataComRespDto implementCurrentContentFinancialAndStandardDataCom(ImplementCurrentContentFinancialAndStandardDataComReqDto reqDto){
    

      if((reqDto!= null&&  reqDto.getTureOrFalse() !=null && reqDto.getTureOrFalse().equals("TRUE"))) {
        //if(D7执行当前内容财务及标准数据(公共).财务是否计算 等于 是)  62214

     ImplementUpdateCurAcctPushRedisComRespDto implementUpdateCurAcctPushRedisComRespDto = null;
    ImplementUpdateCurAcctPushRedisComReqDto implementUpdateCurAcctPushRedisComReqDto=new ImplementUpdateCurAcctPushRedisComReqDto();
  if(reqDto!=null){
      implementUpdateCurAcctPushRedisComReqDto.setDataObjectBatchCode(reqDto.getDataObjectBatchCode());//SimpleFieldAssign//sourceId:1568907_1_62215
implementUpdateCurAcctPushRedisComReqDto.setBudgetAccountId(reqDto.getBudgetAccountId());//SimpleFieldAssign//sourceId:1769198_1_62215
implementUpdateCurAcctPushRedisComReqDto.setPhysicalAccountId(reqDto.getPhysicalAccountId());//SimpleFieldAssign//sourceId:1769194_1_62215
implementUpdateCurAcctPushRedisComReqDto.setBillAmount(reqDto.getBillAmount());//SimpleFieldAssign//sourceId:1568906_1_62215
implementUpdateCurAcctPushRedisComReqDto.setIsIncomingAccount(reqDto.getIsIncomingAccount());//SimpleFieldAssign//sourceId:1568910_1_62215
implementUpdateCurAcctPushRedisComReqDto.setIsOpenFundsArrival(reqDto.getIsOpenFundsArrival());//SimpleFieldAssign//sourceId:1568909_1_62215
implementUpdateCurAcctPushRedisComReqDto.setBillBizStory(reqDto.getBillBizStory());//SimpleFieldAssign//sourceId:1568902_1_62215
implementUpdateCurAcctPushRedisComReqDto.setFundUsageSubjectld(reqDto.getFundUsageSubjectld());//SimpleFieldAssign//sourceId:1769197_1_62215
implementUpdateCurAcctPushRedisComReqDto.setBudgetExpenseSubjectld(reqDto.getBudgetExpenseSubjectld());//SimpleFieldAssign//sourceId:1769195_1_62215
implementUpdateCurAcctPushRedisComReqDto.setBudgetExpensesReceivedSubjectld(reqDto.getBudgetExpensesReceivedSubjectld());//SimpleFieldAssign//sourceId:1769196_1_62215
implementUpdateCurAcctPushRedisComReqDto.setRelSubBudgetAccountCode(reqDto.getRelSubBudgetAccountCode());//SimpleFieldAssign//sourceId:1568912_1_62215
implementUpdateCurAcctPushRedisComReqDto.setOppositeLogo(reqDto.getOppositeLogo());//SimpleFieldAssign//sourceId:1568903_1_62215
implementUpdateCurAcctPushRedisComReqDto.setOppositeName(reqDto.getOppositeName());//SimpleFieldAssign//sourceId:1568904_1_62215
    }
  
    /*D7-执行更新当前账户（公共）[8488]   */
    Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getDataObjectBatchCode(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-数据对象批次标识不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getPhysicalAccountId(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-实体账户ID不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getBillAmount(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-账单金额不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getIsOpenFundsArrival(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-是否开启资金到账不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getBillBizStory(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-流水业务故事信息不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getFundUsageSubjectld(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-资金使用科目ID不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getBudgetExpenseSubjectld(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-预算费用支出科目ID不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getBudgetExpensesReceivedSubjectld(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-预算费用到账科目ID不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getOppositeLogo(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-对方logo不能为空",false);
Assert.isNull(implementUpdateCurAcctPushRedisComReqDto.getOppositeName(),"D7执行当前内容财务及标准数据(公共)-D7-执行更新当前账户（公共）-对方名称不能为空",false);
      implementUpdateCurAcctPushRedisComRespDto = financeService.implementUpdateCurAcctPushRedisCom(implementUpdateCurAcctPushRedisComReqDto)/*vcase invoke isSameApp*/;
      
      
      
BottomUpdateEntityStatisticalAccountComRespDto bottomUpdateEntityStatisticalAccountComRespDto = null;
    BottomUpdateEntityStatisticalAccountComReqDto bottomUpdateEntityStatisticalAccountComReqDto=new BottomUpdateEntityStatisticalAccountComReqDto();
  bottomUpdateEntityStatisticalAccountComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1768996_1_67711
  if(reqDto!=null){
      bottomUpdateEntityStatisticalAccountComReqDto.setDataObjectBatchCode(reqDto.getDataObjectBatchCode());//SimpleFieldAssign//sourceId:1768994_1_67711
bottomUpdateEntityStatisticalAccountComReqDto.setIsOpenFundsArrival(reqDto.getIsOpenFundsArrival());//SimpleFieldAssign//sourceId:1768995_1_67711
bottomUpdateEntityStatisticalAccountComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1768993_1_67711
    }

    /*D7刷新全模板财务账户并推Redis(公共)[8410]   */
    Assert.isNull(bottomUpdateEntityStatisticalAccountComReqDto.getDataObjectBatchCode(),"D7执行当前内容财务及标准数据(公共)-D7刷新全模板财务账户并推Redis(公共)-数据对象批次标识不能为空",false);
Assert.isNull(bottomUpdateEntityStatisticalAccountComReqDto.getIsOpenFundsArrival(),"D7执行当前内容财务及标准数据(公共)-D7刷新全模板财务账户并推Redis(公共)-是否开启资金到账不能为空",false);
Assert.isNull(bottomUpdateEntityStatisticalAccountComReqDto.getEvaluationTemplateId(),"D7执行当前内容财务及标准数据(公共)-D7刷新全模板财务账户并推Redis(公共)-评价模板ID不能为空",false);
Assert.isNull(bottomUpdateEntityStatisticalAccountComReqDto.getSpaceId(),"D7执行当前内容财务及标准数据(公共)-D7刷新全模板财务账户并推Redis(公共)-创建于空间ID不能为空",false);
      bottomUpdateEntityStatisticalAccountComRespDto = financeService.bottomUpdateEntityStatisticalAccountCom(bottomUpdateEntityStatisticalAccountComReqDto)/*vcase invoke isSameApp*/;



      }
//virtualUsage D4更新汇报及相关标准数据(公共)  67710
      RefreshReportAndRelateStandardDataComRespDto refreshReportAndRelateStandardDataComRespDto = null;
    RefreshReportAndRelateStandardDataComReqDto refreshReportAndRelateStandardDataComReqDto=new RefreshReportAndRelateStandardDataComReqDto();
  if(reqDto!=null){
      refreshReportAndRelateStandardDataComReqDto.setDataObjectBatchCode(reqDto.getDataObjectBatchCode());//SimpleFieldAssign//sourceId:1768986_1_67710
refreshReportAndRelateStandardDataComReqDto.setCalcStartTime(reqDto.getCalcStartTime());//SimpleFieldAssign//sourceId:1768985_1_67710
refreshReportAndRelateStandardDataComReqDto.setCycleStageDataId(reqDto.getCycleStageDataId());//SimpleFieldAssign//sourceId:1823338_1_67710
refreshReportAndRelateStandardDataComReqDto.setPreUpdateCycleId(reqDto.getPreUpdateCycleId());//SimpleFieldAssign//sourceId:1801334_1_67710
refreshReportAndRelateStandardDataComReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:1768973_1_67710
refreshReportAndRelateStandardDataComReqDto.setCycleTypeCode(reqDto.getCycleTypeCode());//SimpleFieldAssign//sourceId:1768974_1_67710
refreshReportAndRelateStandardDataComReqDto.setCycleStartTime(reqDto.getCycleStartTime());//SimpleFieldAssign//sourceId:1769092_1_67710
refreshReportAndRelateStandardDataComReqDto.setCycleEndTime(reqDto.getCycleEndTime());//SimpleFieldAssign//sourceId:1769093_1_67710
refreshReportAndRelateStandardDataComReqDto.setIsLastCycle(reqDto.getIsLastCycle());//SimpleFieldAssign//sourceId:1768979_1_67710
refreshReportAndRelateStandardDataComReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1768980_1_67710
refreshReportAndRelateStandardDataComReqDto.setTargetCycleContentId(reqDto.getTargetCycleContentId());//SimpleFieldAssign//sourceId:1768981_1_67710
refreshReportAndRelateStandardDataComReqDto.setOperationInductionId(reqDto.getOperationInductionId());//SimpleFieldAssign//sourceId:1768984_1_67710
refreshReportAndRelateStandardDataComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1768982_1_67710
refreshReportAndRelateStandardDataComReqDto.setPeriodicModeTypeCode(reqDto.getPeriodicModeTypeCode());//SimpleFieldAssign//sourceId:1768987_1_67710
refreshReportAndRelateStandardDataComReqDto.setIsOpenSymbolicAchievements(reqDto.getIsOpenSymbolicAchievements());//SimpleFieldAssign//sourceId:1768990_1_67710
refreshReportAndRelateStandardDataComReqDto.setTargetScoreUnit(reqDto.getTargetScoreUnit());//SimpleFieldAssign//sourceId:1768988_1_67710
refreshReportAndRelateStandardDataComReqDto.setEntityAccountId(reqDto.getPhysicalAccountId());//SimpleFieldAssign//sourceId:1769145_1_67710
refreshReportAndRelateStandardDataComReqDto.setFundUnit(reqDto.getFundUnit());//SimpleFieldAssign//sourceId:1769166_1_67710
    }

    /*D4更新汇报及相关标准数据(公共)[9480]   */
    Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getDataObjectBatchCode(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-数据对象批次标识不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCalcStartTime(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-计算开始时间不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCycleStageDataId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-周期阶段资料记录ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCycleId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-归属周期ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCycleTypeCode(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-周期类型标识不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCycleStartTime(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-周期开始时间不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getCycleEndTime(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-周期结束时间不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getIsLastCycle(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-是否末级周期不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getEvaObjTargetCycleId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-被评对象目标周期ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getTargetCycleContentId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-归属目标内容ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getOperationInductionId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-操作人就职记录ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getEvaluationTemplateId(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-冗余评价模板ID不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getPeriodicModeTypeCode(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-周期模式类型编码不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getIsOpenSymbolicAchievements(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-是否开启标志性成果不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getTargetScoreUnit(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-目标得分单位不能为空",false);
Assert.isNull(refreshReportAndRelateStandardDataComReqDto.getFundUnit(),"D7执行当前内容财务及标准数据(公共)-D4更新汇报及相关标准数据(公共)-资金单位不能为空",false);
      refreshReportAndRelateStandardDataComRespDto = fwCalcTargetCalcClient.refreshReportAndRelateStandardDataCom(refreshReportAndRelateStandardDataComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;



ImplementCurrentContentFinancialAndStandardDataComRespDto retData = new ImplementCurrentContentFinancialAndStandardDataComRespDto();

  

  
  
return retData;
  }
  //
}
